package o;

import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.huawei.appgallery.downloadengine.api.SessionDownloadTask;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.appgallery.foundation.application.pkgmanage.model.update.ApkUpgradeInfo;
import com.huawei.appmarket.service.predownload.thread.PreDownloadManagerThread;
import com.huawei.appmarket.service.predownload.thread.PreDownloadManagerThread.ApkUpgradeInfoComparator;
import com.huawei.appmarket.service.predownload.thread.PreDownloadManagerThread.e;
import java.util.Comparator;
import java.util.List;
import o.dkb.d;

public class dqs extends dpn<Boolean, Boolean> implements e {
    private List<? extends ApkUpgradeInfo> ˋ;

    protected /* synthetic */ Object ˋ(Context context, Object obj) throws InterruptedException {
        return ˎ(context, (Boolean) obj);
    }

    protected /* synthetic */ void ˏ(Context context, Object obj, Object obj2) throws InterruptedException {
        ˊ(context, (Boolean) obj, (Boolean) obj2);
    }

    protected /* synthetic */ Object ॱ(Context context) throws InterruptedException {
        return ˏ(context);
    }

    public dqs() {
        this.ˊ = "WishDlManagerTask";
    }

    protected Boolean ˏ(Context context) {
        if (eny.ˊ().ʼ()) {
            Logger.ˎ(this.ˊ, "Wish task do not need to start.");
            return Boolean.valueOf(false);
        } else if (ejj.ˊ().ˎ()) {
            Logger.ˎ(this.ˊ, "child mode is open.");
            return Boolean.valueOf(false);
        } else if (!UserSession.getInstance().isLoginSuccessful()) {
            Logger.ˎ(this.ˊ, "no login.");
            return Boolean.valueOf(false);
        } else if (!dhq.ॱ().ˎ()) {
            return Boolean.valueOf(false);
        } else {
            ᐝ();
            this.ˋ = eny.ˊ().ˋ();
            if (this.ˋ.size() <= 0) {
                Logger.ˎ(this.ˊ, "no Wise Info waiting install.");
                return Boolean.valueOf(false);
            }
            edj ˋ = edh.ˋ(context);
            if (ˋ.ॱ || ˋ.ˎ > edl.ˏ().ˊ()) {
                return Boolean.valueOf(true);
            }
            Logger.ˎ(this.ˊ, "batteryStatus:" + ˋ.toString());
            return Boolean.valueOf(false);
        }
    }

    private void ᐝ() {
        eny.ˊ().ॱॱ();
    }

    protected Boolean ˎ(Context context, Boolean bool) {
        if (bool == null || !bool.booleanValue() || this.ˋ == null) {
            return Boolean.valueOf(false);
        }
        Logger.ˎ("ScheduleRepeatService", this.ˊ + " execute:" + this.ˋ.size());
        new PreDownloadManagerThread(context, this.ˋ, this).ॱ();
        return Boolean.valueOf(true);
    }

    protected void ˊ(Context context, Boolean bool, Boolean bool2) {
    }

    public void ˏ() {
        Logger.ˎ(this.ˊ, "start wish dl");
    }

    public int ॱ() {
        return 5;
    }

    public Comparator<ApkUpgradeInfo> ˋ() {
        return new ApkUpgradeInfoComparator();
    }

    public void ˊ(@Nullable SessionDownloadTask sessionDownloadTask, @NonNull ApkUpgradeInfo apkUpgradeInfo, d dVar) {
        edw.ॱ(apkUpgradeInfo, sessionDownloadTask, "Wish", "wishdl_", 5, "wlanWishDl", dVar);
    }

    public boolean ˎ() {
        return true;
    }

    public boolean ˋ(SessionDownloadTask sessionDownloadTask) {
        return eny.ˊ().ˏ(sessionDownloadTask.ˎ(), sessionDownloadTask.ˊˊ(), sessionDownloadTask.ॱᐝ());
    }

    public int ˊ(@NonNull SessionDownloadTask sessionDownloadTask) {
        return 3;
    }

    public void ˊ(int i) {
        Logger.ˎ(this.ˊ, "end wish dl:" + i);
    }

    public void ˊ(List<String> list) {
    }

    public void ʼ() {
    }
}
